package com.itheima.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.itheima.common.Paging;
import com.itheima.dto.NewsDto;
import com.itheima.dto.WebsocketDto;
import com.itheima.entity.News;
import com.itheima.vo.NewsVo;
import com.itheima.vo.WebsocketVo;

import java.util.List;

/**
 * @author 51585
 * @description 针对表【news】的数据库操作Service
 * @createDate 2022-10-26 09:55:02
 */
public interface NewsService extends IService<News> {
    /**
     * 发送消息
     *
     * @param websocketDto
     * @throws Exception
     */
    void sendPersonalNews(WebsocketDto websocketDto) throws Exception;

    /**
     * 展示最近20条聊天记录
     *
     * @param bUserId
     * @return
     */
    List<NewsVo> showRecentNews(String bUserId) throws Exception;

    /**
     * 分页展示所有聊天记录
     * @param newsDto
     * @return
     * @throws Exception
     */
    Paging<NewsVo> pageNews(NewsDto newsDto) throws Exception;

    /**
     * 更新消息状态
     * @param bUserId
     * @throws Exception
     */
    void updateReadStatus(String bUserId) throws Exception;

    /**
     * 撤回消息
     * @param newsId
     * @throws Exception
     */
    void deleteNews(Integer newsId) throws Exception;

    /**
     * 查看当前登录用户是否有未读消息，如果有则进行推送
     *
     * @param userId 用户id
     * @return webSocket服务端到客户端vo
     */
    List<WebsocketVo> offlineNews(String userId);
}
